﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class QOrder : IQEvaluable
{
    public IQEvaluable Column { get; set; }
    public eQOrder Order { get; set; }
    public QOrder(string  column)
        :this(column:new QColumn( column),order:eQOrder.Asc)
    {     
    }
    public QOrder(string column, eQOrder order)
        : this(column: new QColumn(column), order: order)
    {
    }
    public QOrder(IQEvaluable column)
    {
        this.Column = column;
        this.Order = eQOrder.Asc;
    }

    public QOrder(IQEvaluable column, eQOrder order)
    {
        this.Column = column;
        this.Order = order;
    }
    

    public string Evalute()
    {
        var enumToString = new Func<eQOrder, string>((eQOrder order) =>
        {
            string output = "";
            switch (order)
            {
                case eQOrder.Asc:
                    output = " Asc "; break;
                case eQOrder.Desc:
                    output = " Desc "; break;
            }
            return output;
        });
        return this.Column.Evalute() + " " + enumToString.Invoke(this.Order);
    }



    public string EvaluteWithAlias()
    {
        throw new NotImplementedException();
    }
}
